<template>
	<view class="container">
		<!-- <view class="items" @click="routerLink('./apply')">
			访客申请
		</view>
		<view class="items" @click="routerLink('./applicationProgress')">
			申请进度
		</view>
		<view class="items" @click="routerLink('./passCheck')">
			电子通行证
		</view> -->

			<up-cell title="访客申请" :isLink="true" @click="routerLink('./apply')"></up-cell>
			<up-cell title="申请进度" :isLink="true" @click="routerLink('./applicationProgress')"></up-cell>
			<up-cell title="电子通行证" :isLink="true" @click="routerLink('./passCheck')"></up-cell>
		<up-toast ref="uToastRef"></up-toast>
	</view>
</template>

<script>
	import {
		getPass
	} from '../../api/reportedMaintenance.js'
	export default {
		data() {
			return {
				show: false,
			};
		},
		methods: {
			routerLink(url) {
				if (url == './passCheck') {
					getPass().then((res) => {
						if (res.code == 2000) {
							uni.navigateTo({
								url: url
							})
						} else {
							this.$refs.uToastRef.show({
								type: 'error',
								icon: false,
								message: res.msg
							})
						}
					})
				} else {
					uni.navigateTo({
						url: url
					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 25rpx;

		.items {
			padding: 30rpx 20rpx;
			border-bottom: 1rpx #ccc solid;
		}
	}
</style>